package com.fjp.heartguard.viewmodel

import androidx.databinding.ObservableField
import androidx.lifecycle.MutableLiveData
import com.fjp.heartguard.R
import com.fjp.heartguard.app.data.bean.UserInfo
import com.fjp.heartguard.app.network.HttpRequestCoroutine
import me.hgj.jetpackmvvm.base.appContext
import me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel
import me.hgj.jetpackmvvm.ext.request
import me.hgj.jetpackmvvm.state.ResultState

/**
 *Author:Mr'x
 *Time:2025/1/1
 *Description:
 */
class VerificationCodeViewModel : BaseViewModel() {
    var codeResult = MutableLiveData<ResultState<String>>()
    var checkCodeResult = MutableLiveData<ResultState<String>>()

    fun getCode(mobile: String) {
        request({
            HttpRequestCoroutine.getCode(mobile)
        }, codeResult, false)
    }

    fun checkCode(mobile:String,code: String) {
        request({
            HttpRequestCoroutine.checkCode(mobile,code)
        }, checkCodeResult, false)
    }

    val sendPhone = ObservableField<String>("")
    val verificationCodeisEnabled = ObservableField(false)
    val verificationCodeText = ObservableField("")
}